# @Author: TonghuiWu
# @Date:   2018-11-23 23:58:21
# @Last Modified by:   TonghuiWu
# @Last Modified time: 2018-11-24 00:30:40
# @E-mail: wutonghui22@163.com

import xadmin

from .models import UserAsk, CourseCommen, UserFavorite, UserMessage, UserCourse


class UserAskAdmin(object):
    """
    '用户咨询'表在后台管理中的管理设置
    """
    list_display = ['name', 'mobile', 'course_name', 'add_time']
    search_fields = ['name', 'mobile', 'course_name']
    list_filter = ['name', 'mobile', 'course_name', 'add_time']

class CourseCommenAdmin(object):
    """
    '课程评论'表在后台管理中的管理设置
    """
    list_display = ['user', 'course', 'comments', 'add_time']
    search_fields = ['user', 'course', 'comments']
    list_filter = ['user__nick_name', 'course__name', 'comments', 'add_time']

class UserFavoriteAdmin(object):
    """
    '用户收藏'表在后台管理中的管理设置
    """
    list_display = ['user', 'fav_id', 'fav_type', 'add_time']
    search_fields = ['user', 'fav_id', 'fav_type']
    list_filter = ['user__nick_name', 'fav_id', 'fav_type', 'add_time']

class UserMessageAdmin(object):
    """
    '用户消息'表在后台管理中的管理设置
    """
    list_display = ['user', 'message', 'has_read', 'add_time']
    search_fields = ['user', 'message', 'has_read']
    list_filter = ['user', 'message', 'has_read', 'add_time']

class UserCourseAdmin(object):
    """
    '用户学习记录'表在后台管理中的管理设置
    """
    list_display = ['user', 'course', 'add_time']
    search_fields = ['user', 'course']
    list_filter = ['user__nick_name', 'course__name', 'add_time']


xadmin.site.register(UserAsk, UserAskAdmin)
xadmin.site.register(CourseCommen, CourseCommenAdmin)
xadmin.site.register(UserFavorite, UserFavoriteAdmin)
xadmin.site.register(UserMessage, UserMessageAdmin)
xadmin.site.register(UserCourse,UserCourseAdmin)